package com.topvision.controller.hes;

import com.topvision.model.hes.HesExpert;
import com.topvision.model.hes.HesUserDeviceZwannumber;
import com.topvision.service.api.hes.HesUserDeviceZwannumberService;
import com.topvision.service.hes.HesExpertService;
import com.topvision.service.hes.HesUserService;
import com.topvision.service.region.RegionService;
import com.topvision.util.R;
import com.topvision.vo.hes.HesCallVO;
import com.topvision.vo.hes.HesUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 科渡用户
 *
 * @author shengwm
 * @email 179653076@qq.com
 * @date 2017-08-30 14:27:46
 */
@RestController
@Api(value = "科渡用户信息接口", description = "科渡用户信息接口")
@RequestMapping("hes/hesuser")
public class HesUserApiController {
    @Autowired
    private HesExpertService hesExpertService;
    @Autowired
    private RegionService regionService;
    @Autowired
    private HesUserDeviceZwannumberService hesUserDeviceZwannumberService;
    @Autowired
    private HesUserService hesUserService;



    /**
     * 信息
     */
    @RequestMapping(value = "/hesZwanNumber", method = RequestMethod.POST)
    @ApiOperation(value = "用户名找紫万号码回拨", produces = MediaType.APPLICATION_JSON_VALUE,notes = "根据用户名找紫万号码回拨",response = R.class)
    public R getUserZwanNumber( @RequestParam String username){
        Map<String,Object> map = new HashMap<>();
        map.put("username",username);
        List<HesUserDeviceZwannumber> hesUserDeviceZwannumbers = hesUserDeviceZwannumberService.queryByParam(map);

        return R.success().put("hesUserDeviceZwannumber", hesUserDeviceZwannumbers);
    }

    /**
     * 信息
     */
    @RequestMapping(value = "/hesusers", method = RequestMethod.POST)
    @ApiOperation(value = "用户列表", produces = MediaType.APPLICATION_JSON_VALUE,notes = "所有用户列表",response = R.class)
    public R hesusers( @RequestParam String username){
        Map<String,Object> map = new HashMap<>();
        map.put("username",username);
        List<HesCallVO> hesCallVOs = hesUserService.callUsers(map);
        return R.success().put("users", hesCallVOs);
    }


}
